home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / lib / extra / resource.a < prev    next >
Text File  |  1994-02-01  |  1KB  |  57 lines

  1.  
  2.  ;  EXEC resource support
  3.  ;                   4(sp)  8(sp)
  4.  ;    AutoAllocMiscResource(resno, value)
  5.  ;        resno:  MR_SERIALPORT, SERIALBITS, PARALLELPORT, PARALLELBITS
  6.  ;        value:  -1 to allocate, 0 to check
  7.  ;
  8.  ;        returns 0 on success
  9.  ;
  10.  ;    AutoFreeMiscResource(resno)
  11.  ;                  4(sp)
  12.  ;        Free a misc resource you allocated
  13.  ;
  14.  ;    No need to open the misc.resource
  15.  
  16.  
  17.         section text,CODE
  18.  
  19.         xdef    _AutoAllocMiscResource
  20.         xdef    _AutoFreeMiscResource
  21.         xref    _LVOOpenResource
  22.  
  23. _AutoAllocMiscResource:
  24.         move.l  A6,-(sp)
  25.         bsr     OpenMiscResource
  26.         beq     amfail
  27.         move.l  8(sp),D0
  28.         move.l  12(sp),A1
  29.         jsr     -6(A6)
  30.         bra     amret
  31. amfail        moveq.l #-1,D0
  32. amret        move.l  (sp)+,A6
  33.         rts
  34.  
  35. _AutoFreeMiscResource:
  36.         move.l  A6,-(sp)
  37.         bsr     OpenMiscResource
  38.         beq     fmret
  39.         move.l  8(sp),D0
  40.         jsr     -12(A6)
  41. fmret        move.l  (sp)+,A6
  42.         rts
  43.  
  44. OpenMiscResource:
  45.         move.l  4,A6
  46.         lea.l   MiscName(pc),A1
  47.         jsr     _LVOOpenResource(A6)
  48.         move.l  D0,A6
  49.         tst.l   D0
  50.         rts
  51.  
  52. MiscName:   dc.b    $6D,$69,$73,$63,$2E,$72,$65,$73,$6F,$75,$72,$63,$65,$00
  53.  
  54.         END
  55.  
  56.  
  57.